package com.sgcc.nfc.lock.domain.model

import android.os.Parcelable
import kotlinx.parcelize.Parcelize

enum class LockStatus(val code: Int) {
    CLOSED(0),
    OPEN(1),
    MALFUNCTION(2),
    UNKNOWN(-1);

    companion object {
        fun from(code: Int?): LockStatus = when (code) {
            CLOSED.code -> CLOSED
            OPEN.code -> OPEN
            MALFUNCTION.code -> MALFUNCTION
            else -> UNKNOWN
        }
    }
}

enum class LockType {
    SMART_LOCK,
    NFC_LOCK,
    UNKNOWN
}

@Parcelize
data class Lock(
    val lockId: Long,
    val lockName: String,
    val lockNfcId: String,
    val lockType: LockType,
    val status: LockStatus,
    val batteryLevel: Int?,
    val lastHeartbeat: String?,
    val roomId: Long?,
    val roomName: String?,
    val latitude: Double?,
    val longitude: Double?,
    val address: String?
) : Parcelable
